﻿using MaterialDesignThemes.Wpf;
using System;
using System.Globalization;
using System.Windows.Data;

namespace UpperComputer.WPF.Entry.Converters
{
    public class StringToIconPackConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //ArgumentNullException.ThrowIfNull(value, "value");
            if (value == null)
            {
                return PackIconKind.Monitor;
            }
            Enum.TryParse(typeof(PackIconKind), value.ToString(), out object result);
            PackIconKind packIconKind = result == null ? PackIconKind.Monitor : (PackIconKind)result;
            return packIconKind;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
